@XDATA{macmillan:pub,
  IDS       = {macmillan:pubALIAS},
  PUBLISHER = {Macmillan}
}

@XDATA{macmillan:loc,
  LOCATION = {New York and London},
  NOTE     = {A Note} 
}

@XDATA{macmillan,
  IDS   = {macmillanalias},
  XDATA = {macmillan:pubALIAS, macmillan:loc}
}


@BOOK{xd1,
  AUTHOR        = {Edward Ellington},
  DATE          = {2007},
  XDATA         = {macmillanalias, missingxd}
}

@BOOK{xd2,
  AUTHOR        = {Peter Pillington},
  DATE          = {2003},
  PUBLISHER     = {Routledge},
  XDATA         = {macmillan:loc, bltxxd1}
}

% Loop detection test
@BOOK{xd3,
  AUTHOR        = {Edward Ellington},
  DATE          = {1923},
  XDATA         = {loop}
}

@XDATA{loop:1,
  NOTE = {Note}
}

@XDATA{loop:2,
  XDATA = {loop:3}
}

@XDATA{loop:3,
  XDATA = {loop}
}

@XDATA{loop,
  XDATA = {loop:1, loop:2}
}

% Granular XDATA tests
@BOOK{gxd1,
  AUTHOR = {Simon Smith and xdata=gxd2-author-1}, % Picks name 1
  EDITOR = {xdata=gxd2-editor-2},
  TITLE  = {xdata=gxd4-title},
  LOCATION = {xdata=gxd3-location-1 and B}, % Picks list element 1
  PUBLISHER = {xdata=gxd2},             % malformed (unspecified field)- output literally
  NOTE = {xdata=gxd2-note},             % malformed (missing field) - output literally
  TRANSLATOR = {xdata=gxd2-author-3},   % malformed (bad position) - output literally
  LISTA = {xdata=gxd3-location-5},      % malformed (bad position) - output literally
  ADDENDUM = {xdata=missing},           % malformed (missing entry) - output literally
  ORGANIZATION = {xdata=gxd2-author-3}, % malformed (incompatible types)- output literally
  NAMEA = {xdata=lxd1-author-1}         % malformed (not an XDATA ref)- output literally
}

@BOOK{gxd1g,
  AUTHOR = {Simon Smith and xdata=gxd2-author}, % Picks all names, no position
  EDITOR = {xdata=gxd2-editor-2},
  TITLE  = {xdata=gxd4-title},
  LOCATION = {xdata=gxd3-location and B}, % Picks all list elements
  PUBLISHER = {xdata=gxd2},             % malformed (unspecified field)- output literally
  NOTE = {xdata=gxd2-note},             % malformed (missing field) - output literally
  TRANSLATOR = {xdata=gxd2-author-3},   % malformed (bad position) - output literally
  LISTA = {xdata=gxd3-location-5},      % malformed (bad position) - output literally
  ADDENDUM = {xdata=missing},           % malformed (missing entry) - output literally
  ORGANIZATION = {xdata=gxd2-author-3}, % malformed (incompatible types)- output literally
  NAMEA = {xdata=lxd1-author-1}         % malformed (not an XDATA ref)- output literally
}

@XDATA{gxd2,
  AUTHOR = {Brian Bloom and Arthur Anderson},
  EDITOR = {William Wool and xdata=gxd4-editor-1}
}

@XDATA{gxd3,
  LOCATION = {A and C}
}

@XDATA{gxd4,
  EDITOR = {Frank Frill},
  TITLE =  {Some title}
}

% Granular loop detection XDATA test
@BOOK{lxd1,
  AUTHOR = {Simon Smith and xdata=lxd1:loop-author-1},
  EDITOR = {xdata=lxd3:loop-editor-1}
}

@XDATA{lxd1:loop,
  AUTHOR = {xdata=lxd2:loop-author-1}
}

@XDATA{lxd2:loop,
  AUTHOR = {xdata=lxd1:loop-author-1}
}

@XDATA{lxd3:loop,
  EDITOR = {xdata=lxd4:loop-editor-1}
}

@XDATA{lxd4:loop,
  EDITOR = {xdata=lxd4:loop-editor-1}
}

% annotation inheritance via xdata
@XDATA{notes,
  NOTE    = {A note},
  NOTE+an = {=bignote}
}

@XDATA{auths,
  EDITOR    = {John Doe and Jane Doe and May Bee},
  EDITOR+an = {1=bigishauthor;3=bigauthor}
}

@XDATA{nloc,
  LOCATION = {xdata=loc-location-2}
}

@XDATA{loc,
  INSTITUTION    = {inst1 and inst2},
  INSTITUTION+an = {2=biginst},
  LOCATION       = {xloc1 and xloc2},
  LOCATION+an    = {2=bigloc}
}

@XDATA{pub,
  PUBLISHER    = {MacMillan},
  PUBLISHER+an = {1=bigpublisher}
}

@BOOK{xdann1,
  AUTHOR      = {Arthur Smith and xdata=auths-editor-3 and xdata=auths-editor-1 and Bill Blogs},
  AUTHOR+an   = {1=biggerauthor},
  EDITOR      = {Raymond Little and xdata=auths-editor and Gerald Roth},
  TITLE       = {Very Long Title with XDATA},
  LOCATION    = {loca and xdata=nloc-location-1 and xdata=loc-location-2},
  NOTE        = {xdata=notes-note},
  INSTITUTION = {xdata=loc-institution and inst3},
  XDATA       = {pub}
}
